$PBExportHeader$uo_tp_sql_multilinea.sru
forward
global type uo_tp_sql_multilinea from uo_tp_multilinea
end type
end forward

global type uo_tp_sql_multilinea from uo_tp_multilinea
event ue_creasqlinsert ( )
end type
global uo_tp_sql_multilinea uo_tp_sql_multilinea

type variables
string		is_sqlprev[]
end variables

forward prototypes
public function integer uof_getsqlprev (ref string as_sqlprev[])
end prototypes

event ue_creasqlinsert;int				li_ret
string			ls_reset[]
int				ll_loopcol,	ll_looprow
dwitemstatus	ldwitemstatus

for ll_looprow = 1 to dw_1.rowcount()
/*
	for ll_loopcol = 1 to long(dw_1.Object.DataWindow.Column.Count)
//		li_ret = dw_1.setitemstatus( ll_looprow, ll_loopcol, Primary!, New!)
//		ldwitemstatus = dw_1.getitemstatus( ll_looprow, ll_loopcol, Primary!)
		li_ret = dw_1.setitemstatus( ll_looprow, ll_loopcol, Primary!, NewModified!)
		ldwitemstatus = dw_1.getitemstatus( ll_looprow, ll_loopcol, Primary!)
	next
*/		
	li_ret = dw_1.setitemstatus( ll_looprow, 0, Primary!, NewModified!)
next

is_sqlprev[] = ls_reset[]

// Evita el sql delete 
dw_1.RowsDiscard(1, dw_1.DeletedCount(), Delete!)

dw_1.update()


end event

public function integer uof_getsqlprev (ref string as_sqlprev[]);as_sqlprev[] = is_sqlprev[]
return 1
end function

on uo_tp_sql_multilinea.create
call super::create
end on

on uo_tp_sql_multilinea.destroy
call super::destroy
end on

event ue_iniciar;call super::ue_iniciar;string		ls_reset[]

is_sqlprev[] = ls_reset[]
end event

event dw_1::sqlpreview;if request = PreviewFunctionUpdate! then
	choose case sqltype
		case PreviewUpdate! , PreviewInsert!, PreviewDelete!
			is_sqlprev[upperbound(is_sqlprev[])+1] = sqlsyntax + ';'
			return 2
	end choose
end if


end event

type pb_insertar from uo_tp_multilinea`pb_insertar within uo_tp_sql_multilinea
boolean BringToTop=true
end type

type pb_borrar from uo_tp_multilinea`pb_borrar within uo_tp_sql_multilinea
boolean BringToTop=true
end type

